//
//  SQConfirmLookViewController.m
//  energy
//
//  Created by 周曼迪 on 2021/7/8.
//

#import "SQConfirmLookViewController.h"

#import "SQQueryModel.h"
#import "SQHierarchyModel.h"

#import "NSString+NCDate.h"
#import "SQShowImage.h"

#import "SQPlayVoiceView.h"


@interface SQConfirmLookViewController ()<BaseTableVCInterface>

@property (strong, nonatomic)SQQueryModel *queryModel;

@property (weak, nonatomic) IBOutlet UIView *view_palyVioce;
@property (strong, nonatomic) SQPlayVoiceView * playVoiceView;

@property (weak, nonatomic) IBOutlet UIView *view_confirm;
@property (weak, nonatomic) IBOutlet UIButton *btn_confirm;
@property (weak, nonatomic) IBOutlet UITextField *tf_type;//隐患类别
@property (weak, nonatomic) IBOutlet UITextField *tf_level;//隐患等级
@property (weak, nonatomic) IBOutlet UITextField *tf_rectificationType;//隐患整改类型
@property (weak, nonatomic) IBOutlet UITextField *tf_completionTime;//计划完成时间
@property (weak, nonatomic) IBOutlet UITextField *tf_money;
@property (weak, nonatomic) IBOutlet UITextField *tf_prevention;//防控措施
@property (weak, nonatomic) IBOutlet UITextField *tf_system;//制度措施清单
@property (weak, nonatomic) IBOutlet UITextField *tf_rectification;//整改措施
@property (weak, nonatomic) IBOutlet UITextView *tv_note;//备注
//༥༤༽ཀབཀྲ་ཤིས་བདེ་ལེགས།

@property (weak, nonatomic) IBOutlet UIView *view_information;
@property (weak, nonatomic) IBOutlet UIButton *btn_information;

@property (weak, nonatomic) IBOutlet UITextField *tf_area;//区域
@property (weak, nonatomic) IBOutlet UITextField *tf_people;//发现人

@property (weak, nonatomic) IBOutlet UITextField *tf_class;//班组
@property (weak, nonatomic) IBOutlet UITextField *tf_department;//部门
@property (weak, nonatomic) IBOutlet UITextField *tf_company;//公司
@property (weak, nonatomic) IBOutlet UITextField *tf_assessmentTime;//评估时间
@property (weak, nonatomic) IBOutlet UITextView *tv_describe;//隐患描述

@property (weak, nonatomic) IBOutlet UIImageView *img_picOne;
@property (weak, nonatomic) IBOutlet UIImageView *img_picTwo;
@property (weak, nonatomic) IBOutlet UIImageView *img_picThree;

@property (weak, nonatomic) IBOutlet UIView *headerviewHighly;


@end

@implementation SQConfirmLookViewController

- (void)viewDidLoad {
    self.tableViewInterface = self;
    [super viewDidLoad];
    self.navigationItem.title = @"隐患确认";
    self.view_confirm.hidden = NO;
    self.view_information.hidden = YES;
    self.playVoiceView = [[SQPlayVoiceView alloc] init];
    
    [self.view_palyVioce addSubview:self.playVoiceView];
    [self getConfirmLookData];
    
}


-(void)getConfirmLookData{
    [SQQueryModel getDataWithParams:@{@"hd_id":self.hd_id} WithCallBack:^(SQQueryModel * data) {
        self.queryModel = data;
        
        self.tf_area.text = data.data.site_area;
        self.tv_describe.text = data.data.hd_danger_description;
        self.tf_people.text = data.data.hd_report_person_text;
        self.tf_class.text = data.data.hd_confirm_team_person_text;
        self.tf_department.text = data.data.hd_confirm_department_person_text;
        self.tf_company.text = data.data.hd_confirm_company_person_text;
        self.tf_assessmentTime.text = [NSString formateDate:[data.data.hd_report_time substringWithRange:NSMakeRange(6,13)]];
        
        self.tf_type.text = data.data.hd_category_text;
        self.tf_level.text = data.data.hd_level_text;
        self.tf_rectificationType.text = data.data.hd_rectification_type_text;
        self.tf_completionTime.text = data.data.hd_plan_complete;
        self.tf_money.text = data.data.hd_rectification_funds_text;
        self.tf_prevention.text = data.data.hd_prevention_and_control_measures;
        self.tf_system.text = data.data.hd_list_of_system_measures;
        self.tf_rectification.text = data.data.hd_rectification_measures;
        
        [self.playVoiceView buildPlayVoiceVie:data.data.hd_report_pic_audio];
        
        
        
        [self.img_picOne setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",LC_ImageHeader,data.data.hd_report_pic_one]] placeholder:[UIImage imageNamed:@"addImage"]];
        
        [self.img_picTwo setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",LC_ImageHeader,data.data.hd_report_pic_two]] placeholder:[UIImage imageNamed:@"addImage"]];
        
        [self.img_picThree setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",LC_ImageHeader,data.data.hd_report_pic_three]] placeholder:[UIImage imageNamed:@"addImage"]];
        
        [self.tableView beginUpdates];
        self.tableView.tableHeaderView.height = W(661);
        [self.tableView  endUpdates];
        
    }];
}





//༥༤༽ཀབཀྲ་ཤིས་བདེ་ལེགས།


-(NSInteger)rowsCount:(NSInteger)section{
    return 0;
}


- (NSArray<NSArray<NSString *> *> *)classArr{
    return @[@[@"SQConfirmTableViewCell"]];
}



//༥༤༽ཀབཀྲ་ཤིས་བདེ་ལེགས།

/**隐患确认
*/
- (IBAction)clickConfirm:(UIButton *)sender {
    [self.tableView beginUpdates];
    self.tableView.tableHeaderView.height = W(661);
    [self.tableView  endUpdates];
   
    [self.btn_confirm setTitleColor:[UIColor colorNamed:@"AccentColor"] forState:UIControlStateNormal];
    [self.btn_information setTitleColor:[UIColor colorNamed:@"333Color"] forState:UIControlStateNormal];
    self.view_confirm.hidden = NO;
    self.view_information.hidden = YES;
    
}


/**隐患信息*/
- (IBAction)clickInformation:(UIButton *)sender {
    [self.tableView beginUpdates];
    self.tableView.tableHeaderView.height = W(731);
    [self.tableView  endUpdates];

    [self.btn_information setTitleColor:[UIColor colorNamed:@"AccentColor"] forState:UIControlStateNormal];
    [self.btn_confirm setTitleColor:[UIColor colorNamed:@"333Color"] forState:UIControlStateNormal];
    self.view_confirm.hidden = YES;
    self.view_information.hidden = NO;
    
}

#pragma mark -- 图片放大

- (IBAction)clickShowImage:(UIButton *)sender {

    if (sender.tag == 10) {
        [SQShowImage showImage:self.img_picOne];
    }else if (sender.tag == 20){
        [SQShowImage showImage:self.img_picTwo];
    }else if (sender.tag == 30){
        [SQShowImage showImage:self.img_picThree];
    }
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
